package com.my.service.impl;

import com.my.dao.AddressMapper;
import com.my.dao.UserInfoMapper;
import com.my.entity.UserInfo;
import com.my.service.ManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class ManageServiceimpl implements ManageService {
    @Autowired(required = false)
    UserInfoMapper userInfoMapper;
    @Autowired(required = false)
    AddressMapper addressMapper;

    @Override
    public List<UserInfo> getList() {
        return userInfoMapper.getList();
    }


    @Override
    @Transactional
    public int deleteUsserInfo(long id) {
        int result = userInfoMapper.deleteUserInfo(id);

        int result2=addressMapper.deleteaddressuserid(id);

       if(result ==1 && result2 ==1){
           return  1;
       }else {
           return  0;
       }
    }



}
